home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / wtek0693.zip / OOPALLEY.ZIP / RANGE.CPP < prev    next >
C/C++ Source or Header  |  1993-04-27  |  671b  |  37 lines

  1. #include "range.h"
  2.  
  3. #define THIS    Range
  4. #define BASE    Object
  5. DEFINE_CLASS(Range,Object);
  6.  
  7. //======= Public member functions:
  8.  
  9. Object* Range::copy() const
  10. {
  11.     return shallowCopy();
  12. }
  13.  
  14. void Range::deepenShallowCopy()  {}
  15.  
  16. unsigned Range::hash() const
  17. {
  18.     return (first^len);
  19. }
  20.  
  21. bool Range::isEqual(const Object& p) const
  22. // Test two objects for equality
  23. {
  24.     return p.isSpecies(class_Range) && *this==*(Range*)&p;
  25. }
  26.  
  27. void Range::printOn(ostream& strm) const
  28. {
  29.     strm << first << ":" << len;
  30. }
  31.  
  32. const Class* Range::species() const
  33. // Return a pointer to the descriptor of the species of this class
  34. {
  35.     return &class_Range;
  36. }
  37.